home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / security / doc / clippings / 910820-02 < prev    next >
Encoding:
Internet Message Format  |  1991-09-12  |  3.6 KB

  1. From: jkp@cs.HUT.FI (Jyrki Kuoppala)
  2. Newsgroups: comp.unix.admin
  3. Subject: Re: World-writable /etc/utmp (was something else)
  4. Message-ID: <1991Aug20.022920.24954@nntp.hut.fi>
  5. Date: 20 Aug 91 02:29:20 GMT
  6. References: <SHERK.91Aug15120343@nmc.cit.cornell.edu> <19526@darkstar.ucsc.edu>     <8214@tekgen.BV.TEK.COM> <1991Aug17.121526@thuja.gsfc.nasa.gov>     <1991Aug18.061739.8097@nntp.hut.fi>     <SHERK.91Aug18130621@nmc.cit.cornell.edu>     <1991Aug18.181134.8266@world.std.com> <BR
  7. Organization: Helsinki University of Technology, Finland
  8.  
  9. In article <mattson.682622518@ishin>, mattson@ishin (Jim Mattson) writes:
  10. >Aside from comsat abuses, are there any other serious problems with a
  11. >world-writable utmp?  If comsat is the only real problem, I'd rather
  12. >just disable comsat on workstations, rather than breaking other things
  13. >(in our environment, mail is never actually delivered on a workstation,
  14. >so disabling comsat is a nop).  Of course, you can spoof other users by
  15. >writing bogus entries to /etc/utmp, but what mechanisms other than comsat
  16. >actually allow you to access/destroy files that you wouldn't be able to
  17. >otherwise?  Am I missing something obvious?
  18.  
  19. I found the following paragraph from my old archives:
  20.  
  21. It seems probable that also talkd has this hole, although with talkd
  22. you can write only to files which are writable to the group (along the
  23. normal tty permissions).
  24.  
  25. Many programs will crash if users write random garbage in utmp - there
  26. are probably a few security holes which haven't been found yet that
  27. can be opened by this.  Wall / rwall for example still crashes if utmp
  28. contains garbage (Sun seems to have fixed it in quite a non-obvious
  29. way, I did some RTFB'ing to see what it does).
  30.  
  31. Somebody also told me that syslog, if configured to write messages to
  32. root, operator etc, can also be used to break security.
  33.  
  34.  
  35. Here's a description about 4.1.1 rwall / wall, nothing important, skip if
  36. you aren't pervertly interested in all those network daemons ;-):
  37.  
  38. My understanding is that they didn't fix rpc.rwalld, but made
  39. /bin/wall first stat() the ut_line and check it's a char special
  40. device, then open it and do isatty() on it.  If either of these fails,
  41. it refuses to write to the file and syslog()s an error message.
  42.  
  43. But /bin/wall still has bugs - it copies the ut_line to a static buffer
  44. with strcpy(), making it possible to overwrite wall's private
  45. variables with as many kb of data in utmp as you want.  Before I took
  46. the time to disassemble /bin/wall properly, I thought the first stat()
  47. was open() and though it forgot to close the ut_line file when
  48. returning, and thought: hey, this is easy, just overwrite _iobuf with
  49. some suitable data to make _cleanup() on exit() to write something
  50. nice to the file which wall forgets to close.
  51.  
  52. But it does close the file if the isatty() fails, so this scheme
  53. doesn't work (would have been fun).  There might be another way, but I
  54. didn't think of one.  In addition to overwriting _iobuf (or is it
  55. _iob), you can also overwrite the strings it syslog()s and perhaps
  56. something else - but I didn't find overwriting these very useful in
  57. breaking security.
  58.  
  59. I didn't bother to check thoroughly, but on a quick look at talkd it
  60. seems talkd might have the same problem.  I wouldn't be surprised if
  61. other daemons or scripts run from cron or commands run by root can be
  62. fooled to do something nasty with a utmp containing some suitable data
  63. - some status programs like w or finger dump core on a corrupted utmp,
  64. and if these are run by root you might be able to write some code or
  65. something in them to compromise security (a la the fingerd buffer
  66. overflow the internet worm was using).
  67.  
  68. //Jyrki
  69.  
  70.